package com.nine.gxh.model;

import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.nine.gxh.converter.DictTypeConverter;
import com.ruoyi.common.annotation.Excel;
import lombok.Data;
import org.apache.poi.ss.usermodel.IndexedColors;

import java.util.Date;

/**
 * @author: duonine
 * @date: 2023/7/3
 */
@Data
@TableName("gxh_info_channel")
public class GxhInfoChannel {

    // 防止出现精度丢失，需要将Long类型转为String类型进行返回
    @TableId(value = "id", type = IdType.AUTO)
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    @ExcelProperty(value = "频道名称")
    @Excel(name = "频道名称", width = 18, cellType = Excel.ColumnType.STRING)
    @TableField(value = "name")
    private String name;

    // 频道分类
    @ExcelProperty(value = "频道分类", converter = DictTypeConverter.class)
    @Excel(name = "频道分类", dictType = "gxh_channel_type")
    @TableField(value = "ctype")
    private String ctype;

    @ExcelProperty(value = "简介")
    @Excel(name = "简介", width = 30, backgroundColor = IndexedColors.SKY_BLUE)
    @TableField(value = "content")
    private String content;

    @ExcelProperty(value = "排序")
    @Excel(name = "排序", cellType = Excel.ColumnType.NUMERIC)
    @TableField(value = "ordernum")
    private int ordernum;

    @ExcelProperty(value = "创建日期")
    @Excel(name = "创建日期", dateFormat = "yyyy-MM-dd")
    @TableField(value = "createdate")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date createdate;

    @TableField(value = "isdelete")
    private int isdelete;

}
